#include <bits/stdc++.h>
using namespace std;
const int N=1e5+5;
struct pla{
	int st,en;
}e[N],r[N];
bool cmp(pla x,pla y){
	return x.st<y.st;
}
int n,a,b;
map<int,int> mk[N];
int ans;
priority_queue<int,vector<int>,greater<int> > q;
int cnt;
int sol_1(int n){
	cnt=n;
	if(n==0) return 0;
	if(n>=a) return a;
	for(int i=1;i<=n;i++) q.push(e[i].en);
	for(int i=n+1;i<=a;i++){
		if(e[i].st>q.top()){
			cnt++;
			q.pop();
			q.push(e[i].en);
		}
	}
	while(!q.empty()) q.pop();
	return cnt;
}
int sol_2(int n){
	cnt=n;
	if(n==0) return 0;
	if(n>=b) return b;
	for(int i=1;i<=n;i++) q.push(r[i].en);
	for(int i=n+1;i<=b;i++){
		if(r[i].st>q.top()){
			cnt++;
			q.pop();
			q.push(r[i].en);
		}
	}
	while(!q.empty()) q.pop();
	return cnt;
}
int main(){
	freopen("airport.in","r",stdin);
	freopen("airport.out","w",stdout);
	int i;
	scanf("%d%d%d",&n,&a,&b);
	if(n>=(a+b)){
		printf("%d\n",a+b);
		return 0;
	};
	for(i=1;i<=a;i++) scanf("%d%d",&e[i].st,&e[i].en);
	for(i=1;i<=b;i++) scanf("%d%d",&r[i].st,&r[i].en);
	sort(e+1,e+a+1,cmp);
	sort(r+1,r+b+1,cmp);
	/*
	for(i=1;i<=a;i++) printf("%d %d\n",e[i].st,e[i].en);
	for(i=1;i<=b;i++) printf("%d %d\n",r[i].st,r[i].en);
	*/
	for(i=0;i<=n;i++){
		ans=max(ans,sol_1(i)+sol_2(n-i));
	}
	printf("%d\n",ans);
	return 0;
}
